package blockr.function;

public class GetCipherCode {    //计算秘钥
    private static int G = 0;

    public static int CipherCode(int arraySize) {
        int length = (MappedBiggerFileReader.getPiece_index() - 1) / (arraySize * 8);    //所有片数*每片有的byte数*每个byte8位二进制
        if (MappedBiggerFileReader.isAdd()) {    //添加新块
            G = (arraySize * 8 * 2) - length % (arraySize * 8);
        } else {  //不添加新块
            G = (arraySize * 8) - length % (arraySize * 8);
        }
        return G;
    }

    public static int getG() {
        return G;
    }
}
